<template>
	<view class="login">
		<image class="logo" src="/static/images/icon.png" mode="aspectFill"></image>
		<view class="btn login" @click="loginByWeixin">授权登陆</view>
		<view class="btn cancel" @click="noLogin">我再想想</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			noLogin(){
				uni.switchTab({
					url:'/pages/index/index'
				})
			},
			loginByWeixin() {
				let that = this;
				vk.userCenter.loginByWeixin({
				
					success: (data) => {
						vk.alert(data.msg);
						that.data = data;
						let backUrl = vk.vuex.get('$app.backUrl')
						setTimeout(()=>{
							if(backUrl){
								uni.reLaunch({
									url:backUrl
								})
							}else{
								uni.switchTab({
									url:'/pages/index/index'
								})
							}
						},1000)
					
					}
				});
			},	
		
		}
	}
</script>

<style lang="less">
	.login{
		display: flex;
		flex-direction: column;
		align-items: center;
		
		.logo{
			width: 180rpx;
			height: 180rpx;
			margin-top: 200rpx;
			margin-bottom: 150rpx;
		}
		
		.btn{
			background-color: #E93323;
			width: 650rpx;
			text-align: center;
			border-radius: 100rpx;
			color: white;
			padding: 20rpx 0;
		}
		
		.cancel{
			margin-top: 30rpx;
			color: #ccc;
			border: 1px solid #ccc;
			background-color: white;
		}
	}
</style>
